from django.db import models
from doctor.models import Doctor
from patient.models import Patient
from appointment.models import Appointment

# Create your models here.
class Apply(models.Model):
    name = models.CharField(max_length=255,null=True,blank=True)

    position = models.CharField(max_length=255,null=True,blank=True)

    description = models.TextField(null=True,blank=True)

    price = models.FloatField(null=True, blank=True)

    time = models.DateTimeField(auto_now_add=True)

    # 完成状态：是否完成，可以使用布尔字段，True表示完成，False表示未完成
    status = models.CharField(max_length=255,null=True,blank=True)

    result = models.TextField(null=True,blank=True)

    patient_id = models.ForeignKey(Patient, on_delete=models.CASCADE)

    doctor_id = models.ForeignKey(Doctor, on_delete=models.CASCADE)

    appointment = models.ForeignKey(Appointment, on_delete=models.CASCADE)

    pay_status = models.CharField(
        max_length=20,
        choices=[
            ('paid', '已缴费'),
            ('pending', '未交费'),
            ('refund', '已退费'),
        ],
        default='pending'
    )

